package top.chj.day18.genericity.上下限1;

/**
 * @Auther:小陈的Java
 * 上限extends，下限super
 */
public class Demo3<T> {
    private int id;
    private T t;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public T getT() {
        return t;
    }

    public void setT(T t) {
        this.t = t;
    }

    public static void main(String[] args) {
        Demo3<? extends Number> demo3 = new Demo3<>();
        demo3.setT(null);

        Demo3<Integer> demo32 = new Demo3<Integer>();
        demo3 = demo32;
        Demo3<String> demo33 = new Demo3<>();
        //向上转型失败
        //demo3 = demo33;

        Demo3<? super Integer> demo34 = new Demo3<>();

        Demo3<Integer> demo35 = new Demo3<>();
        demo34 = demo35;
    }
}
